<?php
require_once dirname(__FILE__) . '/config.inc.php';
require_once dirname(__FILE__) . '/lib.interface.php';

class MooJson {
	static function encode($data) {
		return urldecode(json_encode(url_encode($data)));
	}
	
	static function decode($data, $returnArray = true) {
		return json_decode($data, $returnArray);
	}
}

/*转换中文*/
function url_encode($str) {
	if(is_array($str)) {
		foreach($str as $key=>$value) {
			$str[urlencode($key)] = url_encode($value);
		}
	} else {
		$str = urlencode($str);
	}
	return $str;
}